//
//  SACollectionNoticeViewController.m
//  SunOn
//
//  Created by mc on 2017/5/5.
//  Copyright © 2017年 NeoZhang. All rights reserved.
//

#import "SACollectionNoticeViewController.h"
#import "SACollectionNoticeChildViewController.h"
#import "WMPageController.h"

@interface SACollectionNoticeViewController ()<WMPageControllerDelegate,WMPageControllerDataSource>

@property (nonatomic, strong) WMPageController *scrollerView;
@property (weak, nonatomic) IBOutlet UILabel *noticeTitle;
@property (weak, nonatomic) IBOutlet UILabel *noticeContent;
@property (weak, nonatomic) IBOutlet UILabel *noticeTime;
@property (nonatomic, strong) NSArray *titleData;
@property (weak, nonatomic) IBOutlet UIView *titleview;
@end

@implementation SACollectionNoticeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view. 111
//    [self addChildViewController:self.scrollerView];
    [self.view insertSubview:self.scrollerView.view belowSubview:self.titleview];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - Datasource & Delegate
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titleData.count;
}
- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titleData[index];
}
- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    SACollectionNoticeChildViewController *vcClass = [[SACollectionNoticeChildViewController alloc] init];
    vcClass.type = index;
    return vcClass;
}
#pragma mark - getter&setter
- (WMPageController *)scrollerView {
    if (!_scrollerView) {
        self.scrollerView = [[WMPageController alloc] init];
        self.scrollerView.viewFrame = CGRectMake(0, 161, SASCREEN_WIDTH, SASCREEN_HEIGHT - 161);
        self.scrollerView.delegate = self;
        self.scrollerView.dataSource = self;
        self.scrollerView.titleSizeNormal = 15;
        self.scrollerView.titleSizeSelected = 15;
        self.scrollerView.menuViewStyle = WMMenuViewStyleLine;
        self.scrollerView.pageAnimatable = YES;
        self.scrollerView.titleColorSelected = [UIColor colorWithHexString:@"#0084fd"];
        self.scrollerView.titleColorNormal = [UIColor blackColor];
        self.scrollerView.menuItemWidth = SASCREEN_WIDTH / 2;
        self.scrollerView.progressColor = [UIColor colorWithHexString:@"#0084fd"];
        self.scrollerView.menuHeight = 40;
        self.scrollerView.menuBGColor = [UIColor whiteColor];
        self.scrollerView.progressWidth = SASCREEN_WIDTH / 2;
    }
    return _scrollerView;
}
- (NSArray *)titleData {
    if (!_titleData) {
        _titleData = @[@"我发送的",@"我接收的"];
    }
    return _titleData;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
